package gridmath;

import preprocessing.WindowingSystem;
import datastructures.UserParameters;

public class PenetranceCalculator extends CaseMatrixBase {

	private final int Cases;
	private final double minPenetrance;
	
	public PenetranceCalculator(UserParameters userparams, WindowingSystem windowmaker) {
		super(windowmaker, userparams.getMaxorder());
		Cases = userparams.getNumber_of_cases();
		minPenetrance = userparams.getPenetrance();
		
		specialTypeOfOperation = MatrixOperations.calculatePenetrantCases;	//this is a Expected Case calclulator
		specialTypeOfOperand = MatrixOperations.calculateMaxCases;	//this expects a frequency matrix as an argument
	}

	public double doOperation(double maxCases) {
		return Math.min( Math.floor( maxCases*minPenetrance ), (double) Cases+1); 
	}
	

}
